The term platform is used to refer to a processor/hardware and operating system combination. Binary translators allow binaries built for a particular platform (source) to execute on another platform (target) by translating the machine instructions present in the binary code into equivalent instructions of the target platform. Binary translation can be performed either statically, wherein a new binary image is created for running directly on the target platform, or dynamically wherein the translation takes place while the binary is executed. Different types of binary translators are described by Erik R. Altman, David Kaeli, and Yaron Sheffer, in “Welcome to the Opportunities of Binary Translation.”, IEEE Computer, 33 (3), March 2000, pp 40-45.
The translated code produced by such translators is native to the processor on which it is to be run and as such, can provide performance close to native compiled binaries. However, for this to be the case the cost of translation, which is an overhead on the runtime of the binary needs to be minimised while not compromising on quality of generated code. M. Probst discusses this further in “Fast machine-adaptable dynamic binary translation.”, Proceedings of the Workshop on Binary Translation, Barcelona, Spain, September 2001.
Translation is also carried out in other scenarios, such as when databases are upgraded. In some database upgrades, data from the old system is used by the new system. However, while the data format may remain the same, there are commonly changes made to metadata format, that is, the description of how data is stored in the database. Such changes may be made to add new features to the new system.
A significant part of the process is the transformation of data from the source format to the target format in a process referred to as bit filling. In known systems, whenever bit filling is carried out, the process typically involves the following steps:                a) Shift the required bits into the target position.        b) Mask out those bits, which are not required        c) The bits in the target corresponding to those bit positions where the new bits have to be copied into need to be cleared.        d) The source bits are copied into the target by an OR binary operation.        
If the source format bit sequence is such that it needs to be split up and copied into different positions in the target, then the steps above need to be carried out for each subset of bits that are to be copied into a unique location in the target. This results in a significant performance loss. Also, the source bit patterns may need to be split and copied into various target element slots, thereby further reducing performance.
A known solution to bit filling for program translation is inline assembly, which is provided by some compilers. This facility enables the user to code efficient assembly routines into the otherwise high-level language code. However, this solution is platform specific, and requires the programmer to know the instruction set architecture of every processor on which the binary has to execute. Furthermore, inline assembly can restrict possible compiler optimizations.
Transforming data by bit filling during program or database translation is a complex task, which can be carried out automatically. However, the systems available for this are difficult to build and maintain and are also error prone. The result of this is that translated programs run less efficiently and database conversions are less effective.
It is an object of the present invention to provide a method and apparatus for creating data transformation routines for binary data, which avoids some of the above disadvantages or at least provides the public with a useful choice.